﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Estimate.Common.DBFieldTypes;
using Estimate.Common.Estimate;
using Newtonsoft.Json;

namespace Estimate.Reports
{
    /// <summary>
    /// 考核报表接口
    /// </summary>
    public class ZytHandinReport
    {
        StandardReport standardReport;
        ForeSendpointType[] sendpoints;
        ForeSpanType[] wthSpans;
        ForeSpanType[] tempSpans;

        /// <summary>
        /// 考核报表
        /// </summary>
        /// <param name="ConnectionString"></param>
        /// <param name="ReportType">报表类型</param>
        /// <param name="tid"></param>
        public ZytHandinReport(string ConnectionString, ZytHandinReportType ReportType, string tid)
        {
            switch (ReportType)
            {
                case ZytHandinReportType.short_normal: //《短期公众城镇天气预报》
                    standardReport = new StandardReport(ConnectionString, DataTableType.city, null, tid);
                    wthSpans = new ForeSpanType[] { ForeSpanType.FD00_12, ForeSpanType.FD12_24, ForeSpanType.FD00_24, ForeSpanType.FD24_48, ForeSpanType.FD48_72 };
                    tempSpans = new ForeSpanType[] { ForeSpanType.FD00_24, ForeSpanType.FD24_48, ForeSpanType.FD48_72 };
                    break;
                case ZytHandinReportType.short_site://《短期指导站点预报》
                    standardReport = new StandardReport(ConnectionString, DataTableType.zd, null, tid);
                    wthSpans = new ForeSpanType[] { ForeSpanType.FD00_12, ForeSpanType.FD12_24, ForeSpanType.FD00_24, ForeSpanType.FD24_48, ForeSpanType.FD48_72 };
                    tempSpans = new ForeSpanType[] { ForeSpanType.FD00_24, ForeSpanType.FD24_48, ForeSpanType.FD48_72 };
                    break;
                case ZytHandinReportType.middle_site: //《中期指导站点预报》
                    standardReport = new StandardReport(ConnectionString, DataTableType.zd, null, tid);
                    wthSpans = new ForeSpanType[] { ForeSpanType.FD72_96, ForeSpanType.FD96_120, ForeSpanType.FD120_144, ForeSpanType.FD144_168 };
                    tempSpans = new ForeSpanType[] { ForeSpanType.FD72_96, ForeSpanType.FD96_120, ForeSpanType.FD120_144, ForeSpanType.FD144_168 };
                    break;
                case ZytHandinReportType.short_rain://《短期指导降水等值线预报》
                    standardReport = new StandardReport(ConnectionString, DataTableType.js, null, tid);
                    wthSpans = new ForeSpanType[] { ForeSpanType.FD00_12, ForeSpanType.FD12_24, ForeSpanType.FD00_24, ForeSpanType.FD24_48, ForeSpanType.FD48_72 };
                    tempSpans = new ForeSpanType[] { ForeSpanType.FD00_24, ForeSpanType.FD24_48, ForeSpanType.FD48_72 };
                    break;
                case ZytHandinReportType.middle_rain://《中期指导降水等值线预报》
                    standardReport = new StandardReport(ConnectionString, DataTableType.js, null, tid);
                    wthSpans = new ForeSpanType[] { ForeSpanType.FD72_96, ForeSpanType.FD96_120, ForeSpanType.FD120_144, ForeSpanType.FD144_168 };
                    tempSpans = new ForeSpanType[] { ForeSpanType.FD72_96, ForeSpanType.FD96_120, ForeSpanType.FD120_144, ForeSpanType.FD144_168 };
                    break;
                default:
                    break;
            }

            sendpoints = new ForeSendpointType[] { ForeSendpointType.H06, ForeSendpointType.H16 };
        }

        public void Clear()
        {
            standardReport.Clear();
        }

        //public void Initialize()
        //{ 

        //}

        public void PrepareData(DateTime beginDate, DateTime endDate, ForeSemiType semitype)
        {
            


            standardReport.PrepareData(beginDate, endDate, semitype, wthSpans, tempSpans, sendpoints);
        }

        /// <summary>
        /// 获取核查表数据字符串
        /// </summary>
        /// <returns></returns>
        public string GetReportDataString()
        {
            return standardReport.GetReportDataString();
        }

    }
}
